home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Graphics / Fractal Lab Kit 3.0 / Documentation / TeachText / Manual 3.0 (Part 2) < prev   
Encoding:
Text File  |  1994-03-17  |  24.7 KB  |  502 lines  |  [TEXT/ttxt]

  1. ••Basic commands
  2.  
  3. A list of the basic, and most interactive, commands are presented along with an example of their use.  These are the minimum commands necessary to use the program:
  4.  
  5.  
  6. draw
  7.     Draw a fractal based on the current maps.  Press a key to stop.
  8.     E.g.    green color fern draw
  9.  
  10. cdraw
  11.     Plots each map in a different color.
  12.     E.g.    spiral cdraw
  13.  
  14. <n> edit
  15.     Edit the n-th map.  Enter a new value or press return to leave the
  16.     existing value as is.
  17.     E.g.    2 edit
  18.       a = 0.5        ?-0.5    (new value)
  19.       b = -0.5        ?<return>   etc.
  20.  
  21. zero-maps
  22.     Erase all twelve maps.
  23.     E.g.    zero-maps
  24.  
  25. <color.name> color
  26.     Set the current drawing color to the color named.  Valid colors are
  27.     black, wite, red, green, blue, yellow, cyan, magenta
  28.     E.g.    magenta color
  29.  
  30. <n> maps
  31.     Set the number of maps to use to <n>.
  32.     E.g.    4 maps
  33.  
  34. <x> <y> origin
  35.     Set the origin to (x,y).  X and Y are floating point numbers.
  36.     E.g.    -0.354 .789 origin
  37.  
  38. <u> <v> screen
  39.     Set the screen origin to (u,v) (pixels).
  40.     E.g.    120 220 screen
  41.  
  42. <r> range
  43.     Set the range to <r> (floating point).  The viewing window is a
  44.     square with the lower left corner as the origin and side length
  45.     as range.
  46.     E.g.    0.5 range
  47.  
  48. <x> <y> scale
  49.     Set the x-axis and y-axis scales to the floating point values given.
  50.     The default scale is 1.0 for a full screen image.  Changing the scale
  51.     to a value less than one shrinks the image, greater than one expands
  52.     the image.
  53.     E.g.    2.0 2.0 scale
  54.  
  55. mouse
  56.     When issued, mouse will translate the position of the pointer into
  57.     an x,y coordinate allowing the user to 'see' where certain parts of 
  58.     the image are.  Clicking the mouse button will select that point as
  59.     the new origin and decrease the range by a factor of two.
  60.  
  61. on|off axes
  62.     Turn the coordinate axes (really a mark on the origin) ON or OFF.
  63.     E.g.    off axes
  64.  
  65. on|off outlines
  66.     Set showing the map outlines on or off, press a key to continue
  67.     after viewing the outlines.
  68.     E.g.    on outlines
  69.  
  70. settings
  71.     Show a list of the current origin, screen origin, range, scale, number
  72.     of maps and whether the axes and outlines are on or off.
  73.     E.g.    settings
  74.  
  75. findmap
  76.     Allows the user to enter three initial coordinates and three image
  77.     coordinates and calculates the map for those values.
  78.     E.g.    findmap
  79.  
  80. make
  81.     Puts the most recent values from findmap on the stack in order
  82.     for set.  The user needs to add the probability and map number
  83.     before calling set.
  84.     E.g.    make .333 1 set
  85.  
  86. <a> <b> <c> <d> <e> <f> <p> <n> set
  87.     Sets the parameters for a map.  The letters a-f correspond to the 
  88.     values for the matrix and offset vector, <p> is the probability for
  89.     the map and <n> is the map number.  All values except <n> are to
  90.     be floating point numbers.
  91.     E.g.    0.5 -0.5 0.5 0.5 0.0 0.0 0.5 1 set
  92.  
  93. <m1> <m2> copy
  94.     Copy map number <m1> to <m2> without disturbing <m1>.
  95.     E.g.    2 5 copy
  96.  
  97. <m> delete
  98.     Delete map number <m> and move any other maps up in memory.
  99.     E.g.    3 delete
  100. <m> insert
  101.     Insert a blank map before map <m>.
  102.     E.g.    1 insert
  103.  
  104. cls
  105.     Clear the window.
  106.     E.g.    cls
  107.  
  108. bye
  109.     Exit Fractal Lab Kit.
  110.     E.g.    bye
  111.  
  112. ••Using the FindMap command
  113.  
  114. _FindMap_ allows the user to find the parameters for a map by entering the coordinates and where they map to.  This example will use the FindMap command to calculate the maps for the Mandelbrot Dragon.
  115.  
  116. With the program running enter 'findmap'.  You will see be asked to enter the coordinates of three points from the original map.  The origin, the lower right and upper left corners of the initial box (remember, it goes from 0..1 in both x and y) make good starting places.  Therefore, enter 0 for x1 and 0 for y1, (1,0) for (x2,y2), and (0,1) for (x3,y3). These are the default values.  You do not need to enter a decimal point with each number in this case, pressing return uses the value displayed.  For the image points, enter (x1',y1') as (0,0), (x2',y2') as (0.5,0.5) and (x3',y3') as (-0.5,0.5).  The program will calculate the appropriate map and display its values.  At the prompt, enter
  117.  
  118. make 0.5 1 set
  119.  
  120. to make this newly calculated map the first map.  Enter 'findmap' again and press return for each of the original points since we will use the same ones as before.  For the image points enter (x1',y1') as (1,0), (x2',y2') as (0.5,0.5) and (x3',y3') as (0.5,-0.5).  Then enter,
  121.  
  122. make 0.5 2 set 
  123.  
  124. to fix this as the second map.  Lastly, enter,
  125.  
  126. 2 maps 120 220 screen cdraw
  127.  
  128. to use two maps, adjust the screen origin so the image will fit, and draw using color.
  129.  
  130. ••Writing your own fractals to disk
  131.  
  132. Unfortunately, Fractal Lab Kit is unable to write fractal maps to disk. Therefore, when you use {\tt FindMap} to create a new map you must write it down by hand. When you are finished designing a new fractal you can use any text editor, like  TeachText, to create a file to load the map from disk. Simply enter the skeleton code on the next few lines, substituting your values for the letters indicated.  See the structure of the included fractals as an example.
  133.  
  134. : myfractal               ( give it a name, remember, comments in parentheses )
  135.    a b c d e f p 1 set         ( enter the values for map 1 )
  136.    a' b' c' d' e' f' p' 2 set  ( enter the values for map 2, etc. )
  137.    n maps ;              ( `n' is the number of maps you are entering )
  138.  
  139. Once loaded from disk, you need to enter the name of the fractal to load the maps and you are ready to draw.
  140.  
  141. •Advanced Features
  142.  
  143. ••A very (very) brief introduction to programming in Forth
  144.  
  145. Forth is an interpreted, stack based programming language known for its speed and extensibility.  This is not an attempt to completely teach Forth so much as to teach a little about Forth so that the user who is unfamiliar with Forth can make some use of the language.
  146.  
  147. Forth is a stack based language, data is manipulated using a stack that works in a way very similar to the lunch trays in a cafeteria.  The last tray in the stack is the first one out.  Because of this, all mathematical operations are in postfix format, i.e., instead of typing 4 + 7 one would type 4 7  + which would leave the value 11 on the top of the stack.  This illustrates an important thing to remember about using Forth, anything that is entered is interpreted as either a word in the dictionary (more on that later) or a number to be pushed on the stack, so entering 4 7 + told Forth to push a 4 on the stack followed by a 7 and the + word adds the top two stack items.  To see the value stored on the top of the stack use the . word.  Note that this is a destructive operation, it prints the value at the top of the stack and removes it from the stack as well.  To see the top stack value but not remove it you need to enter dup . to first duplicate the top item and then print it.  By default, Forth only operates on 16-bit integers but Pocket Forth supports real numbers as well.  Forth will interpret a value as a real number only if it contains a decimal point!  It is therefore important to enter a decimal point for every number that should be a real number and to not use one on numbers that should be integers.
  148.  
  149. Forth supports the standard arithmetic operations: +, -, *, /  (integers) and f+, f-, f*, f/ (real numbers).  Use f. to print the top of stack as a real number.  fdup duplicates the real number at the top of the stack while fswap will switch the top two real numbers on the stack.  These few words will allow for using Forth as a simple calculator.  Forth, typically, does not support higher mathematical functions, though Pocket Forth does.
  150.  
  151. Forth derives its extensibility from the way in which programs are written.  As Forth interprets tokens from the input line (anything surrounded by spaces is a token) it either pushes it on the stack as a number or looks it up as a word in its dictionary.  A Forth program, therefore, consists of adding definitions to the dictionary.  Definitions are begin with the : word and end with a ; word.  Once defined, the word can be used in subsequent definitions.  Parameters are passed via the stack.  Forth does allow for the use of variables and constants, though these are slower than the stack.  Use the word variable (or fvariable) followed by the name for the variable to create one.  Use «value» constant ( or fconstant) «name» to define a constant.  
  152. Examples:  typing 'fvariable stddev' (no quotes) will create room in the dictionary for a floating point variable named stddev while typing 3.141592 fconstant PI will create a constant for pi. Forth is case-insensitive.  Constants are really special words that push the value on the stack so that typing pi will cause the value to be pushed on the stack.  However,  entering the name of a variable will NOT place its value on the stack, but rather, the address where the variable is stored will be placed on the stack.  To get the value of a variable a two word combination must be used:  stddev f@ will `fetch' the floating point number stored at the address that stddev places on the stack.  Similarly, the value of an integer variable is found using @ instead of f@.  To store a value in a variable, use ! or f!,  3 age ! or 1.414 sqr2 f!.
  153.  
  154. Forth uses several standard control structures:  «if else then», «do loop or +loop», «begin until», «begin while repeat», and «begin again».  The phrase
  155.  
  156. count @ 100 < if ." Yes, there is room" cr 
  157.                    else ." No, there is no room." cr then
  158.  
  159. will check whether the current value of count is less than 100 or not.  Forth supports <, >, and = for comparing integer values.  Pocket Forth has a 
  160. single word for comparing floating point numbers, fcompare, which returns 
  161. a -1 if f1<f2, 0 if f1=f2, and +1 if f1>f2, where f1 and f2 are the top two stack numbers (assumed to be floating point).  It is important to note that unlike most other Forth words, fcompare does _not_ remove the top two 
  162. floating point numbers.  The do loop is similar to the for loops in other languages.  As might be expected, the syntax is  
  163.  
  164. «hi»  «lo»  do  «body» loop 
  165.  
  166. where the index (pushed on the stack by the word r) will go from lo to hi-1.   A variation is to use +loop instead of loop to jump by the value on the top of the stack (which must be positive).  «Begin until» and «begin while repeat»
  167. are for bottom tested and top tested conditional loops.  The condition is the same as the if statement:
  168.  
  169. 0 begin  ." Hello" cr 1+ dup 99 > until  
  170.  
  171. will print the word `Hello' 100 times.  Similarly, this fragment will also 
  172. print `Hello' 100 times:
  173.  
  174. 0 begin  dup 100 <  while  ." Hello" cr 1+  repeat
  175.  
  176.  
  177. ••Putting it all together
  178.  
  179.     The following examples will illustrate the creation of simple Forth words.
  180.  
  181. 1.  Averaging four numbers:
  182.  
  183.                  :  ave4  ( a b c d -- average )  + + + 4 / ;
  184.  
  185. Using integer arithmetic, sum the top four stack items and divide the result by 4.  Illustrates comments which are anything surrounded by `()', note the space after the `('.  The comment given is known as a _stack effect comment_ and shows the word's effect on the stack.  Initial stack items are on the left of the `--' and the result is on the right.
  186.  
  187. 2.  Averaging N floating point numbers
  188.  
  189.                   :  averageN ( a1. ... aN. N -- average. )
  190.                           dup >r                  ( save N on the return stack )
  191.                           1- 0 do f+ loop    ( adjust N and add the values ) 
  192.                            r>                         ( get N off the return stack )
  193.                            0 d>f f/ ;            ( make it real and divide to find average )
  194.  
  195. This example illustrates use of the return stack.  The return stack is the place where Forth places addresses to return to when the current word is done executing.  While a word is executing it is possible to use the return stack for temporary storage, but one must be careful to make sure that all values placed on the stack by >r are removed using r> before the word is done, otherwise Forth will attempt to return to who knows where and will very 
  196. likely crash.  Integers are transformed into real numbers by the two word sequence 0 d>f. This transforms the integer into a double length integer and then into a real number.
  197.  
  198. 3.  Evaluating a function:  y = 3.4e^x:
  199.  
  200.            fvariable x
  201.            : sqr  ( x. -- x.*x. )  fdup f* ;
  202.            : cube  ( x. -- x.^3  )  fdup fdup f* f* ;
  203.            : expf  ( x. -- exp[x.] )  ( use Taylor series approx. )
  204.                  fdup x f! 1.0 f+ x f@ sqr 2.0 f/ f+ x f@ cube 6.0 f/ f+ ;
  205.            : Y  ( x. --  Y[x.] )  expf 3.4 f* ; ( keep x < 1 for accuracy )
  206.  
  207. This is an example of factoring. The code for the square and cube could easily have been left in the definition of expf but factoring them out made the definition shorter and easier to read.  In theory, according to some, a properly factored Forth program combined with well chosen word names and stack effect comments should be nearly self-documenting. By the way, Pocket Forth already has a word for calculating the exponential, expt.  Compare expf with expt to see how large x can be before the error introduced by truncating the Taylor series at x^{3} becomes too great.
  208.  
  209. These examples are brief, but hopefully should be sufficient, especially when combined with a list of Forth words, to allow you to write simple words to extend the power of the program.
  210.  
  211.  
  212. ••The Sierpinski triangle, an example
  213.  
  214.  
  215. The Sierpinski Triangle is a commonly seen fractal consisting of a triangle made of triangles.  This will serve as an example of how the program can be extended by adding words to the Forth dictionary. The triangle is made up of three maps that divide the region 0..1 in x and 0..1 in y into three equal squares.  We will develop a Forth word that will find the maps for the triangle and then generate the fractal. 
  216.  
  217. First, we must determine the maps.  The findmap command's interactive nature is unsuited to our task, fortunately, there are three `primitive' (i.e. non-interactive) words that will perform the same task: initial, image, and solve.  These words operate as follows:
  218.  
  219. x1 y1  x2 y2  x3 y3  initial   
  220. «Sets the initial points for finding a map, (x1,y1),(x2,y2),(x3,y3)»
  221.  
  222. X1 Y1  X2 Y2  X3 Y3  image
  223. «Sets the image points for finding a map, (X1,Y1),(X2,Y2),(X3,Y3)»
  224.  
  225. solve
  226. «Finds the values that will map the initial points to the image points»
  227.  
  228. These words, when combined with 'make' and 'set', will allow us to create a single Forth word to find all three maps at once.  At this point, then, we can write:
  229.  
  230. : sierpinski  ( generates the Sierpinski Triangle)
  231.     ( Set up initial values, for all maps )
  232.     0.0 0.0 1.0 0.0 0.0 1.0 initial
  233.     ( First map )
  234.     0.0 0.0 0.5 0.0 0.0 0.5 image  solve
  235.     make 0.333 1 set
  236.     ( Second map )
  237.     0.5 0.0 1.0 0.0 0.5 0.5 image  solve
  238.     make 0.333 2 set
  239.     ( Third map )
  240.     0.25 0.5 0.75 0.5 0.25 1.0 image  solve
  241.     make 0.333 3 set
  242.  
  243. Now before viewing the fractal show the maps, reset the program, show the settings, and draw the outlines:
  244.  
  245.     ( Show the maps )
  246.     page ." The Sierpinski maps: " cr showmaps
  247.     reset  settings
  248.     key drop  ( wait for a key press )
  249.     ( Show outlines when drawing )
  250.     on outlines
  251.     ( Reset the program and draw the fractal )
  252.     cdraw  ;
  253.  
  254. Try this word and see what happens.
  255.  
  256. ••Basic Forth words
  257.  
  258. The table lists some basic Forth words and their use.  With these it should be possible to define your own words for use with the program.
  259.  
  260. Word             Stack effect              Use
  261. --------------------------------------------------------
  262. swap             ( a b -- b a )           Switch top two stack items 
  263. dup                  ( a -- a a )                Duplicate top of stack
  264. over              ( a b -- a b a )           Bring 2nd to top
  265. rot                ( a b c -- b c a )      Rotate stack items
  266. variable        ( -- )                          Make a variable of next token
  267. constant       ( a -- )                        Make a constant of next token 
  268. +, -, *, /         ( a b -- a$b )             Math, where $ is an operation
  269. mod                ( a b -- a mod b )    Remainder after dividing
  270. drop               ( a -- )                      Drop the top stack item
  271. cr                   ( -- )                          Print a return character 
  272. space            ( -- )                        Print a space (ASCII 32) 
  273. emit             ( a -- )                      Print the character whose code is on the stack
  274. ."                    ( -- )                          Print text until a " found (definitions only)
  275. .                     ( a -- )                      Print the top of stack
  276. key                 ( -- a )                     Get a key, ASCII code on stack
  277. bye                 ( -- )                          Exit from Forth
  278. ?terminal    ( -- b )                         Has a key been pressed?
  279. (                      ( -- )                          Start a comment (remember space)
  280. !pen               ( x y -- )                     Move the pen to (x,y) (pixels)
  281. -to                ( x y -- )                       Line from current to (x,y)
  282. page              ( -- )                          Clear the screen
  283. -->                ( -- )                            Load filename, no spaces!
  284. open              ( -- )                          Load file chosen in Mac dialog
  285. ?button         ( -- t )                          Mouse button down?
  286. @mouse       ( -- x y )                    Push mouse position on stack
  287. save            ( -- )                        Save the current dictionary
  288.  
  289. See the reference section for more words that are program specific.  The last eight words listed are special to Pocket Forth and may not be available on other Forth systems, though there will likely be something similar.  Those interested in seriously learning Forth (some swear that it is the best computer language there is) should get a hold of the book _Starting Forth_ by Leo Brodie (2nd ed. 1987), it is an excellent and entertaining introduction.
  290.  
  291. •Using the Shell
  292.  
  293. Fractal Lab Kit contains a mouse driven shell.  The shell is a single Forth 
  294. word (named shell) that allows you to use the mouse to set many of the parameters used in generating fractals.  The shell makes it easy to change settings, colors, edit and calculate maps, and draw.  The only thing the shell cannot do is load fractals from disk.  The use of the shell is straightforward, simply click on the command you want to execute.  Numerical data is entered at the bottom of the screen.  When more than one item of information needs to be entered you must press the `return' key after each item.  The application menu bar is disabled when the shell is running, use the Forth or Quit commands to exit the shell or program.
  295.  
  296. The shell uses much of the memory available to Forth.  This might cause a problem if you are creating more sophisticated programs.  You can eliminate the shell code by entering 'forget shellcode' when in interactive mode. This is exactly what the Cathedral demo program does.  The code is erased from Forth's memory and will be permanently erased should the word save be entered after the code is cleared.  Alternatively, one could select 'Save Dictionary' from the _File_ menu instead of using the word 'save'.  This will write the current Forth dictionary into the application itself.  This should never be a problem since everyone runs from backup copies only, right?  This is also a way to create a version of Fractal Lab Kit that has more memory for your own programs.
  297.  
  298. If you are designing a new fractal the shell will be handy since it lets you change values quickly. Write your maps down though since Fractal Lab Kit has no ability to save maps to disk!  If you are manipulating a fractal stored on disk you must load it in interactive mode (i.e. go to Forth), enter its name to load the maps, and then enter the shell.  For example, the following lines in interactive mode will load the fern maps from disk and enter the shell to allow you to work with the fractal:
  299.  
  300. --> :maps:fern               (load the maps from disk)
  301. fern shell                     (load the maps & enter the shell)
  302.  
  303. Try switching the signs of the a and c values in the first fern map to change the fern into a weed.  Use the Help command for a quick summary of the commands available in the shell.  Note that the help screen in interactive mode is different than the one in shell mode.
  304.  
  305. •Reference
  306.  
  307. ••Commands
  308.  
  309. draw
  310.     Draw a fractal based on the current maps.  Press a key to stop.
  311.     E.g.    green color fern draw
  312.  
  313. cdraw
  314.     Except for plotting each map in a different color, it is the same as
  315.     draw.
  316.     E.g.    spiral cdraw
  317.  
  318. <n> idraw or <n> icdraw
  319.     Same as draw and cdraw respectively except for iterating through
  320.     <n>*500 points.  Useful for drawing a fractal and stopping without
  321.     user interaction.
  322.  
  323. <n> edit
  324.     Edit the n-th map.  Enter a new value or press return to leave the
  325.     existing value as is.
  326.     E.g.    2 edit
  327.       a = 0.5        ?-0.5    (new value)
  328.       b = -0.5        ?<return>   etc.
  329.  
  330. zero-maps
  331.     Erase all twelve maps.
  332.     E.g.    zero-maps
  333.  
  334. <color.name> color
  335.     Set the current drawing color to the color named.  Valid colors are
  336.     black, wite, red, green, blue, yellow, cyan, magenta
  337.     E.g.    magenta color
  338.  
  339. <n> maps
  340.     Set the number of maps to use to <n>.
  341.     E.g.    4 maps
  342.  
  343.  
  344. <x> <y> origin
  345.     Set the origin to (x,y).  X and Y are floating point numbers.
  346.     E.g.    -0.354 .789 origin
  347.  
  348. <u> <v> screen
  349.     Set the screen origin to (u,v) (pixels).
  350.     E.g.    120 220 screen
  351.  
  352. <r> range
  353.     Set the range to <r> (floating point).  The viewing window is a
  354.     square with the lower left corner as the origin and side length
  355.     as range.
  356.     E.g.    0.5 range
  357.  
  358. <x> <y> scale
  359.     Set the x-axis and y-axis scales to the floating point values given.
  360.     The default scale is 1.0 for a full screen image.  Changing the scale
  361.     to a value less than one shrinks the image, greater than one expands
  362.     the image.
  363.     E.g.    2.0 2.0 scale
  364.  
  365. mouse
  366.     When issued, mouse will translate the position of the pointer into
  367.     an x,y coordinate allowing the user to 'see' where certain parts of 
  368.     the image are.  Clicking the mouse button will select that point as
  369.     the new origin and decrease the range by a factor of two.
  370.     
  371. on|off clear
  372.     Turn clearing of page before drawing on and off. Default is on.
  373.  
  374. on|off axes
  375.     Turn the coordinate axes (really a mark on the origin) ON or OFF.
  376.     E.g.    off axes
  377.  
  378. on|off outlines
  379.     Set showing the map outlines on or off, press a key to continue
  380.     after viewing the outlines.
  381.     E.g.    on outlines
  382.  
  383. settings
  384.     Show a list of the current origin, screen origin, range, scale, number
  385.     of maps and whether the axes and outlines are on or off.
  386.     E.g.    settings
  387.  
  388. findmap
  389.     Allows the user to enter three initial coordinates and three image
  390.     coordinates and calculates the map for those values.
  391.     E.g.    findmap
  392.  
  393. make
  394.     Puts the most recent values from findmap on the stack in order
  395.     for set.  The user needs to add the probability and map number
  396.     before calling set.
  397.     E.g.    make .333 1 set
  398.  
  399. <a> <b> <c> <d> <e> <f> <p> <n> set
  400.     Sets the parameters for a map.  The letters a-f correspond to the 
  401.     values for the matrix and offset vector, <p> is the probability for
  402.     the map and <n> is the map number.  All values except <n> are to
  403.     be floating point numbers.
  404.     E.g.    0.5 -0.5 0.5 0.5 0.0 0.0 0.5 1 set
  405.  
  406. <m1> <m2> copy
  407.     Copy map number <m1> to <m2> without disturbing <m1>.
  408.     E.g.    2 5 copy
  409.  
  410. <m> delete
  411.     Delete map number <m> and move any other maps up in memory.
  412.     E.g.    3 delete
  413.  
  414. <m> insert
  415.     Insert a blank map before map <m>.
  416.     E.g.    1 insert
  417.  
  418. cls
  419.     Clear the window.
  420.     E.g.    cls
  421.  
  422. bye
  423.     Exit Fractal Lab Kit.
  424.     E.g.    bye
  425.     
  426. mem
  427.     Show the available dictionary space.  (Forth only has 32k)
  428.     E.g.    mem
  429.  
  430. ?origin, ?screen, ?scale, ?range, ?maps, ?axes, ?outline, ?clear
  431.     Show individual settings.  settings calls each of these.
  432.  
  433. <n> show
  434.     Show the values of map <n>.
  435.     E.g.    3 show
  436.  
  437. •Primitive commands
  438.  
  439. These commands (words) are `primitive' in the sense that they are called by the regular command words.  As they are standard Forth words they are available to the user as well.
  440.  
  441. input   ( -- a )
  442.     Get a 16-bit integer on the stack.
  443.  
  444. finput  ( -- f b )
  445.     Get a floating point number on the stack and a boolean value that is
  446.     false if the user pressed the return key only, in which case the 
  447.     number is 0.0.
  448.  
  449. #map->addr  ( a -- addr )
  450.     Convert a number for a map into an address to the map location in
  451.     memory.
  452.  
  453. get   ( offset map# -- value )
  454.     Get a value for a particular map.  The offset is a branch into the
  455.     map, each value is 10 bytes long.  The constants a,b,c,d,e,f and p
  456.     are defined to give the proper offset:  c 3 get  returns the c value
  457.     of the third map.
  458.  
  459. update  ( value offset map# -- )
  460.     Put the value in the numbered map at the offset (use  a-f or p).
  461.  
  462. print  ( addr -- )
  463.     Print the map starting at addr.
  464.  
  465. wsize   ( h v -- )
  466.     Resize the window to h pixels high and v pixels across.
  467.  
  468. dot   ( u v -- )
  469.     Draw a dot on the screen at (u,v) (pixels).
  470.  
  471. plot   ( x. y. -- )
  472.     Plot the point (x,y) on the screen.
  473.  
  474. plotto   ( x. y. -- )
  475.     Draw a line from the last plotted point to (x,y).
  476.  
  477. determinant  ( -- d )
  478.     Find the determinant of the 3x3 matrix whose values are stored
  479.     in the floating point variables d1 through d9.  Values in the form:
  480.     [ [d1,d2,d3],[d4,d5,d6].[d7,d8,d9]].
  481.  
  482. x->d  ( -- )
  483.     Copy the values in x1,y1 .. x3,y3 to the matrix d.  Used to setup for
  484.     finding a map.
  485.  
  486. xy->uv  ( x. y. -- u v )
  487.     Change real coordinates (x,y) into screen coordinates (u,v).  Call
  488.     factor first.
  489.  
  490. factor  ( -- )
  491.     Calculates redundant factors for xy->uv to speed drawing.
  492.  
  493. firstpoints  ( -- )
  494.     Get the initial points for a map, interactive.
  495.  
  496. solve3x3  ( -- f. d. c. e. b. a. )
  497.     Solve for a map, calculated values on stack.  Call either firstpoints
  498.     and imagepoints or initial and image before calling solve3x3.
  499.  
  500. outputmap  ( f. d. c. e. b. a. -- )
  501.     Display map values on the stack on the screen.
  502.